/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import Helper.SchedulerHelper;
import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 *
 * @author KIENLT
 */
public class SchedulerDAO {
    public void FillAll(){
        
    }
    
    public static int Insert(Connection cnn, SchedulerHelper obj) throws Exception{
        String strSQL = "INSERT INTO tblScheduler(WeekId, Day) VALUES(?,?)";
        PreparedStatement stmt = cnn.prepareStatement(strSQL);
        stmt.setString(1, obj.getWeekId());
        stmt.setString(2, obj.getSchedulerDate());
        return stmt.executeUpdate();
    }
    
    public static int Update(Connection cnn, SchedulerHelper obj) throws Exception {
        String strSQL = "UPDATE tblScheduler SET WeekId=?, Day=? WHERE SchedulerId=?";
        PreparedStatement stmt = cnn.prepareStatement(strSQL);
        stmt.setString(1, obj.getWeekId());
        stmt.setString(2, obj.getSchedulerDate());
        stmt.setString(3, obj.getSchedulerId());
        return stmt.executeUpdate();
    }
}
